package com.edu.juc.introduction.communication;

import com.edu.juc.introduction.communication.lock.Number;

public class NumberTest {
    public static void main(String[] args) {
        Number number = new Number();
        new Thread(() -> {
            try {
                while (true)
                    number.add();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "加").start();

        new Thread(() -> {
            try {
                while (true)
                    number.sub();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "减").start();
    }
}
